//
// Decompiled by Jadx - 622ms
//
package gc;

import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.google.gson.Gson;
import de.robv.android.xposed.XposedHelpers;
import fm.i;
import fn.b;
import fn.j;
import fn.x;
import fn.y;
import fo.c;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import me.plusne.NativeTools;
import me.plusne.common.Json.JsonHookStatic;
import me.plusne.common.Json.Soul.JsonCheckPagePost;
import o.a;
import org.luckypray.dexkit.query.matchers.ClassMatcher;
import org.luckypray.dexkit.query.matchers.FieldMatcher;
import org.luckypray.dexkit.query.matchers.MethodMatcher;
import org.luckypray.dexkit.result.ClassData;
import org.luckypray.dexkit.result.FieldData;
import org.luckypray.dexkit.result.MethodData;
import r.f;

@a("SOUL")
public final class cf extends x {
    public static String cp;
    public static bt cq;
    public static String cr;
    public j cs;
    public MethodData ct;
    public ClassData cu;
    public FieldData cv;
    public ClassData cw;
    public FieldData cx;
    public View cy;
    public Object cz;
    public boolean da;
    public TextView db;
    public TextView dc;
    public TextView dd;
    public TextView de;
    public boolean df;

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Code restructure failed: missing block: B:130:0x03b1, code lost:
    
        di(null, fn.j.as(r20, "failContent"));
     */
    /* JADX WARN: Code restructure failed: missing block: B:131:?, code lost:
    
        return;
     */
    /* JADX WARN: Failed to find 'out' block for switch in B:14:0x0142. Please report as an issue. */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void dg(cf cfVar, j jVar, Object obj, Object obj2) {
        char c;
        Object obj3;
        List cq2;
        List list;
        String str;
        Iterator it;
        JsonCheckPagePost jsonCheckPagePost;
        cfVar.getClass();
        ArrayList arrayList = jVar.a;
        StringBuilder sb = new StringBuilder();
        Iterator it2 = arrayList.iterator();
        if (it2.hasNext()) {
            while (true) {
                sb.append((CharSequence) it2.next());
                if (!it2.hasNext()) {
                    break;
                } else {
                    sb.append((CharSequence) "/");
                }
            }
        }
        String sb2 = sb.toString();
        sb2.getClass();
        int i = 4;
        switch (sb2.hashCode()) {
            case -1747151409:
                if (sb2.equals("chat/limit/friendly/check")) {
                    c = 0;
                    break;
                }
                c = 65535;
                break;
            case -1697574270:
                if (sb2.equals("/user/show/meta")) {
                    c = 1;
                    break;
                }
                c = 65535;
                break;
            case -926122393:
                if (sb2.equals("search/combo")) {
                    c = 2;
                    break;
                }
                c = 65535;
                break;
            case -513812206:
                if (sb2.equals("chat/limitInfo")) {
                    c = 3;
                    break;
                }
                c = 65535;
                break;
            case -428775547:
                if (sb2.equals("v3/account/token")) {
                    c = 4;
                    break;
                }
                c = 65535;
                break;
            case 2787750:
                if (sb2.equals("v3/post/position")) {
                    c = 5;
                    break;
                }
                c = 65535;
                break;
            case 93020604:
                if (sb2.equals("api/q")) {
                    c = 6;
                    break;
                }
                c = 65535;
                break;
            case 113018214:
                if (sb2.equals("user/homepage/metrics")) {
                    c = 7;
                    break;
                }
                c = 65535;
                break;
            case 197624203:
                if (sb2.equals("v2/online/robot/result")) {
                    c = '\b';
                    break;
                }
                c = 65535;
                break;
            case 220234368:
                if (sb2.equals("chat/aigc/privilege/info")) {
                    c = '\t';
                    break;
                }
                c = 65535;
                break;
            case 232429878:
                if (sb2.equals("mobile/app/version/query")) {
                    c = '\n';
                    break;
                }
                c = 65535;
                break;
            case 384940644:
                if (sb2.equals("teenager/config")) {
                    c = 11;
                    break;
                }
                c = 65535;
                break;
            case 686337632:
                if (sb2.equals("soul-coin/total")) {
                    c = '\f';
                    break;
                }
                c = 65535;
                break;
            case 964374637:
                if (sb2.equals("live/join")) {
                    c = '\r';
                    break;
                }
                c = 65535;
                break;
            case 1026786556:
                if (sb2.equals("v5/post/recommended")) {
                    c = 14;
                    break;
                }
                c = 65535;
                break;
            case 1244399525:
                if (sb2.equals("tag/recommend/square")) {
                    c = 15;
                    break;
                }
                c = 65535;
                break;
            case 1784714477:
                if (sb2.equals("v5/post/homepage")) {
                    c = 16;
                    break;
                }
                c = 65535;
                break;
            case 2023858909:
                if (sb2.equals("v4/post/recommended")) {
                    c = 17;
                    break;
                }
                c = 65535;
                break;
            case 2117714049:
                if (sb2.equals("privilege/supervip/status")) {
                    c = 18;
                    break;
                }
                c = 65535;
                break;
            default:
                c = 65535;
                break;
        }
        JsonHookStatic jsonHookStatic = y.by;
        try {
            switch (c) {
                case 0:
                    if (j.ae("unbanTime")) {
                        if (obj2.getClass().getName().equals("cn.soulapp.android.client.component.middle.platform.bean.FuncSwitch") && !XposedHelpers.getBooleanField(obj2, "status")) {
                            XposedHelpers.setBooleanField(obj2, "status", true);
                            long longField = XposedHelpers.getLongField(obj2, "unbanTime") / 60;
                            if (longField > 0) {
                                f fVar = new f(jsonHookStatic.getActivity());
                                fVar.k();
                                fVar.l("已去除被禁止私聊后的弹窗提示->[剩余" + longField + "分钟解封]");
                            }
                        }
                        return;
                    }
                    return;
                case 1:
                    j.bi(new Object[]{"meta", new Gson().toJson(obj2)});
                    return;
                case 2:
                    for (Object obj4 : (List) XposedHelpers.getObjectField(obj2, "cardList")) {
                        XposedHelpers.setObjectField(obj4, "postList", cb.cq((List) XposedHelpers.getObjectField(obj4, "postList")));
                    }
                    return;
                case 3:
                    if (j.ae("ChatLimit")) {
                        Object aa = j.aa(obj2, "isLimit");
                        if (aa instanceof Boolean) {
                            boolean booleanValue = ((Boolean) aa).booleanValue();
                            j.ab(obj2, "setLimit", new Object[]{Boolean.FALSE});
                            if (booleanValue) {
                                f fVar2 = new f(jsonHookStatic.getActivity());
                                fVar2.n();
                                fVar2.l("已解除聊天限制");
                                return;
                            }
                            return;
                        }
                        return;
                    }
                    return;
                case 4:
                    cb.cr();
                    z.df(true);
                    if (j.ae("visibleSave")) {
                        HashMap hashMap = new HashMap();
                        hashMap.put("isVisible", "0");
                        ac acVar = new ac();
                        acVar.de("https://api-user.soulapp.cn/setting/visible/save", hashMap, "POST");
                        acVar.dg(new aq(26));
                        return;
                    }
                    return;
                case 5:
                    List cq3 = cb.cq((List) obj2);
                    if (cq3 != null) {
                        boolean isEmpty = cq3.isEmpty();
                        obj3 = cq3;
                        if (isEmpty) {
                            return;
                        }
                        XposedHelpers.setObjectField(obj, "data", obj3);
                        return;
                    }
                    return;
                case 6:
                    if (j.ae("AD")) {
                        try {
                            jsonHookStatic.getSoul().setIp((String) XposedHelpers.getObjectField(XposedHelpers.getObjectField(obj, "data"), "ip"));
                        } catch (NoSuchFieldError e) {
                            e.printStackTrace();
                        }
                        obj3 = j.bl("cn.soulapp.android.ad.api.bean.AdResponse", new Object[0]);
                        XposedHelpers.setObjectField(obj, "data", obj3);
                        return;
                    }
                    return;
                case 7:
                    o.d = XposedHelpers.getIntField(obj2, "beViewNum");
                    if (j.ae("LocalMod")) {
                        int cd = y.cd(-1, "LocalMod_followNum");
                        if (cd > -1) {
                            XposedHelpers.setIntField(obj2, "followNum", cd);
                        }
                        int cd2 = y.cd(-1, "LocalMod_beFollowNum");
                        if (cd2 > -1) {
                            XposedHelpers.setIntField(obj2, "beFollowNum", cd2);
                        }
                        int cd3 = y.cd(-1, "LocalMod_beViewNum");
                        if (cd3 > -1) {
                            XposedHelpers.setIntField(obj2, "beViewNum", cd3);
                        }
                        int cd4 = y.cd(-1, "LocalMod_recentViewNum");
                        if (cd4 > -1) {
                            XposedHelpers.setIntField(obj2, "recentViewNum", cd4);
                            return;
                        }
                        return;
                    }
                    return;
                case '\b':
                    if (y.ch("autoMate", false)) {
                        String as = j.as(obj2, "status");
                        if (!"SUCCESS".equals(as)) {
                            if ("BROKEN".equals(as)) {
                                f i2 = f.i();
                                i2.j();
                                i2.g = 1;
                                i2.m(XposedHelpers.getObjectField(obj2, "failContent"));
                                return;
                            }
                            f i22 = f.i();
                            i22.j();
                            i22.g = 1;
                            i22.m(XposedHelpers.getObjectField(obj2, "failContent"));
                            return;
                        }
                        Object objectField = XposedHelpers.getObjectField(obj2, "userInfo");
                        if (objectField != null) {
                            String as2 = j.as(objectField, "userIdEcpt");
                            if (TextUtils.isEmpty(as2)) {
                                return;
                            }
                            di(z.dm(as2), "(" + z.dm(as2) + ")匹配成功 ");
                            return;
                        }
                        return;
                    }
                    return;
                case '\t':
                    if (j.ae("LimitChatAigc")) {
                        XposedHelpers.setObjectField(obj, "data", (Object) null);
                        return;
                    }
                    return;
                case '\n':
                    if (j.ae("Update")) {
                        XposedHelpers.setObjectField(obj, "data", (Object) null);
                        j.bi(new Object[]{"已禁止检查更新"});
                        return;
                    }
                    return;
                case 11:
                    if (j.ae("TeenageMode") && obj2.getClass().getName().equals("cn.soulapp.android.client.component.middle.platform.model.api.account.FuncSetting")) {
                        XposedHelpers.setBooleanField(obj2, "isTeenageMode", false);
                        XposedHelpers.setBooleanField(obj2, "needTeenageExam", true);
                        XposedHelpers.setBooleanField(obj2, "isPopTeenWindow", true);
                        return;
                    }
                    return;
                case '\f':
                    cb.cr();
                    return;
                case '\r':
                    j.as(obj2, "roomId");
                    return;
                case 14:
                case 17:
                    cq2 = cb.cq((List) XposedHelpers.getObjectField(obj2, "postList"));
                    XposedHelpers.setIntField(obj2, "updateCount", cq2.size());
                    XposedHelpers.setObjectField(obj2, "postList", cq2);
                    return;
                case 15:
                    XposedHelpers.setObjectField(obj2, "posts", cb.cq((List) XposedHelpers.getObjectField(obj2, "posts")));
                    return;
                case 16:
                    List list2 = (List) XposedHelpers.getObjectField(obj2, "postList");
                    if (j.ae("checkHomePagePost")) {
                        String as3 = j.as(z.ea(), "userIdEcpt");
                        Iterator it3 = list2.iterator();
                        while (it3.hasNext()) {
                            Object next = it3.next();
                            String as4 = j.as(next, "authorIdEcpt");
                            if (as4 == null || !as4.equals(as3)) {
                                list = list2;
                                str = as3;
                                it = it3;
                            } else {
                                long longField2 = XposedHelpers.getLongField(next, "id");
                                i e2 = b.e(i, "POST_" + longField2);
                                list = list2;
                                str = as3;
                                if (e2 == null) {
                                    ac acVar2 = new ac();
                                    it = it3;
                                    acVar2.dd("https://post.soulapp.cn/v3/post/detail?postId=" + longField2 + "&sourceType=squareRecommend");
                                    String dh = acVar2.dh();
                                    if (TextUtils.isEmpty(dh) || (jsonCheckPagePost = (JsonCheckPagePost) androidx.activity.b.c(dh, JsonCheckPagePost.class)) == null || jsonCheckPagePost.getCode() != 10001 || jsonCheckPagePost.getData() == null || jsonCheckPagePost.getData().getPostExtModel() == null) {
                                        i = 4;
                                    } else {
                                        if ("IN_WEBSITE".equals(jsonCheckPagePost.getData().getPostExtModel().getRiskSource())) {
                                            XposedHelpers.setObjectField(next, "riskSource", "IN_WEBSITE");
                                            String riskType = jsonCheckPagePost.getData().getPostExtModel().getRiskType();
                                            riskType.getClass();
                                            XposedHelpers.setObjectField(next, "riskContent", !riskType.equals("TEXT") ? !riskType.equals("IMAGE") ? "PlusNE模块识别到该瞬间已被其他Soul用户发布过" : "PlusNE模块识别到该图片已被其他Soul用户发布过" : "PlusNE模块识别到该文本已被其他Soul用户发布过");
                                        }
                                        i = 4;
                                        b.k(androidx.activity.b.f("POST_", longField2), 4, jsonCheckPagePost.getData().getPostExtModel().getRiskType(), jsonCheckPagePost.getData().getPostExtModel().getRiskSource());
                                    }
                                } else {
                                    it = it3;
                                    String str2 = e2.c;
                                    if (str2 != null && str2.equals("IN_WEBSITE")) {
                                        XposedHelpers.setObjectField(next, "riskSource", "IN_WEBSITE");
                                        String str3 = e2.e;
                                        str3.getClass();
                                        XposedHelpers.setObjectField(next, "riskContent", !str3.equals("TEXT") ? !str3.equals("IMAGE") ? "PlusNE模块识别到该瞬间已被其他Soul用户发布过" : "PlusNE模块识别到该图片已被其他Soul用户发布过" : "PlusNE模块识别到该文本已被其他Soul用户发布过");
                                    }
                                    i = 4;
                                }
                            }
                            list2 = list;
                            as3 = str;
                            it3 = it;
                        }
                    }
                    cq2 = list2;
                    XposedHelpers.setObjectField(obj2, "postList", cq2);
                    return;
                case 18:
                    if (j.ae("superVIP")) {
                        try {
                            XposedHelpers.setBooleanField(obj2, "hasCancelVIPSubscription", true);
                            XposedHelpers.setBooleanField(obj2, "hasFlyPackage", true);
                            XposedHelpers.setBooleanField(obj2, "hasMyMeet", true);
                            XposedHelpers.setBooleanField(obj2, "showSuperVIP", true);
                            XposedHelpers.setBooleanField(obj2, "superVIP", true);
                            XposedHelpers.setObjectField(obj2, "leftDay", 9999L);
                            XposedHelpers.setObjectField(obj2, "remainDay", 9999L);
                            return;
                        } catch (XposedHelpers.InvocationTargetError e3) {
                            e = e3;
                            e.printStackTrace();
                            return;
                        } catch (NoSuchMethodError e4) {
                            e = e4;
                            e.printStackTrace();
                            return;
                        } catch (NullPointerException e5) {
                            e = e5;
                            e.printStackTrace();
                            return;
                        }
                    }
                    return;
                default:
                    return;
            }
        } catch (NoSuchFieldError e6) {
            e = e6;
        }
    }

    public static void dh(cf cfVar, TextView textView, String str, Object obj) {
        cfVar.getClass();
        if (obj == null && NativeTools.n(JsonHookStatic.l, y.by.getUserInfo())) {
            textView.setVisibility(View.VISIBLE);
            b.e(6, z.dm(str));
            return;
        }
        int intField = XposedHelpers.getIntField(obj, "roundCount");
        int intField2 = XposedHelpers.getIntField(obj, "heartTotalCount");
        int[] iArr = {10, 20, 30, 40, 60, 80, 100, 150, 200, 300, 450, 500, 700, 1000, 1300, 1600, 2100, 2600, 4000, 8000, 16000, 30000, 60000, 120000};
        int i = 10;
        if (intField >= 10) {
            if (intField >= 120000) {
                i = 0;
            } else {
                i = -1;
                for (int i2 = 0; i2 < 24; i2++) {
                    if (intField >= iArr[i2]) {
                        i = iArr[i2 + 1];
                    }
                }
            }
        }
        textView.setVisibility(View.VISIBLE);
        b.e(6, z.dm(str));
        textView.setText("\u3000" + String.format("Num:%d Heart:%d Next:%d", Integer.valueOf(intField), Integer.valueOf(intField2), Integer.valueOf(i - intField)) + "\u3000");
    }

    public static void di(String str, String str2) {
        Handler handler = new Handler(Looper.getMainLooper());
        y.by.getActivity().finish();
        handler.post(new i(new int[]{0}, y.cd(5, "autoMateSleep"), str2, handler, str));
    }

    public final void a() {
        j.bb(c.t(MethodMatcher.create().declaredClass("cn.soulapp.imlib.database.ChatDbManager").returnType("io.objectbox.BoxStore")), new a());
        j.bd("retrofit2.Retrofit", "create", new Object[]{Class.class, new b()});
        try {
            y.by.getSoul().setCallFactoryMethodData(c.t(MethodMatcher.create().usingStrings(new String[]{"soul_repo"}).returnType("okhttp3.OkHttpClient").paramCount(0).modifiers(8)));
        } catch (Throwable th) {
            th.printStackTrace();
        }
        this.ct = c.t(MethodMatcher.create().name("success").paramCount(2).usingStrings(new String[]{"rawResponse must be successful response"}));
        this.cu = c.n(ClassMatcher.create().usingStrings(new String[]{"Request{method=", ", tags="}));
        this.cv = c.p(FieldMatcher.create().declaredClass(((ClassData) this.ct.getParamTypes().get(1)).getName()).type(this.cu.getName()));
        this.cw = c.n(ClassMatcher.create().usingStrings(new String[]{"[\\u0000-\\u001F\\u007F-\\u009F\\p{javaWhitespace}]"}));
        this.cx = c.p(FieldMatcher.create().declaredClass(this.cu.getName()).type(this.cw.getName()));
        FieldData p = c.p(FieldMatcher.create().declaredClass(this.cw.getName()).type(List.class));
        try {
            j.bd("retrofit2.OkHttpCall", "parseResponse", new Object[]{"okhttp3.Response", new c(this, p)});
        } catch (Throwable th2) {
            th2.printStackTrace();
        }
        j.bd(this.ct.getClassName(), this.ct.getMethodName(), new Object[]{((ClassData) this.ct.getParamTypes().get(0)).getName(), ((ClassData) this.ct.getParamTypes().get(1)).getName(), new d(this, p)});
        j.bd("cn.soulapp.android.component.home.user.fragment.PageUserHomeFragment", "updateMatch", new Object[]{Float.TYPE, new e()});
        j.bd("cn.soulapp.android.component.home.user.fragment.PageUserHomeFragment", "initViewsAndEvents", new Object[]{View.class, new f(this)});
        j.ba("cn.soulapp.android.component.home.user.fragment.PageUserHomeFragment", "setUser", new g(this));
        j.bd(y.cj("endata"), "decryption", new Object[]{String.class, String.class, new h()});
    }
}
